@model UpdaterManagement.Models.VersionRelease

<nav aria-label="breadcrumb" class="breadcrumb-ace">
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="/">首页</a></li>
        <li class="breadcrumb-item"><a href="/Version">版本管理</a></li>
        <li class="breadcrumb-item active">版本详情</li>
    </ol>
</nav>

<div class="page-header">
    <div class="d-flex justify-content-between align-items-center">
        <div>
            <h1 class="page-title">
                <i class="bi bi-eye text-primary me-2"></i>版本详情
            </h1>
            <p class="page-subtitle">查看版本 <strong>@Model.Version</strong> 的详细信息</p>
        </div>
        <a href="/Version" class="btn btn-outline-secondary">
            <i class="bi bi-arrow-left me-2"></i>返回列表
        </a>
    </div>
</div>

<div class="row">
    <div class="col-lg-8">
        <div class="card-ace mb-4">
            <div class="card-header">
                <i class="bi bi-info-circle me-2"></i>基本信息
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <table class="table table-borderless">
                            <tr>
                                <td class="text-muted" style="width: 120px;"><strong>产品ID:</strong></td>
                                <td><code class="text-primary">@Model.ProductId</code></td>
                            </tr>
                            <tr>
                                <td class="text-muted"><strong>产品名称:</strong></td>
                                <td><strong>@Model.ProductName</strong></td>
                            </tr>
                            <tr>
                                <td class="text-muted"><strong>企业版本:</strong></td>
                                <td><span class="badge badge-ace-secondary">@(Model.Enterprise?.Name ?? "未知")</span></td>
                            </tr>
                            <tr>
                                <td class="text-muted"><strong>版本号:</strong></td>
                                <td><span class="badge badge-ace-primary">@Model.Version</span></td>
                            </tr>
                            @if (!string.IsNullOrEmpty(Model.VersionUrl))
                            {
                                <tr>
                                    <td class="text-muted"><strong>版本地址:</strong></td>
                                    <td><a href="@Model.VersionUrl" target="_blank" class="text-primary">@Model.VersionUrl</a></td>
                                </tr>
                            }
                        </table>
                    </div>
                    <div class="col-md-6">
                        <table class="table table-borderless">
                            <tr>
                                <td class="text-muted" style="width: 120px;"><strong>创建时间:</strong></td>
                                <td>@Model.CreatedTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                            </tr>
                            <tr>
                                <td class="text-muted"><strong>状态:</strong></td>
                                <td>
                                    @if (Model.IsActive)
                                    {
                                        <span class="badge badge-ace-success">
                                            <i class="bi bi-check-circle me-1"></i>活跃
                                        </span>
                                    }
                                    else
                                    {
                                        <span class="badge badge-ace-secondary">
                                            <i class="bi bi-pause-circle me-1"></i>停用
                                        </span>
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td class="text-muted"><strong>文件状态:</strong></td>
                                <td>
                                    <div class="d-flex gap-2">
                                        @if (!string.IsNullOrEmpty(Model.FilePath))
                                        {
                                            <span class="badge badge-ace-success">
                                                <i class="bi bi-file-zip me-1"></i>有版本文件
                                            </span>
                                        }
                                        @if (!string.IsNullOrEmpty(Model.ManualPath))
                                        {
                                            <span class="badge badge-ace-info">
                                                <i class="bi bi-file-text me-1"></i>有操作手册
                                            </span>
                                        }
                                        @if (string.IsNullOrEmpty(Model.FilePath) && string.IsNullOrEmpty(Model.ManualPath))
                                        {
                                            <span class="text-muted">无文件</span>
                                        }
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        
        @if (!string.IsNullOrEmpty(Model.Description))
        {
            <div class="card-ace">
                <div class="card-header">
                    <i class="bi bi-chat-text me-2"></i>版本描述
                </div>
                <div class="card-body">
                    <div class="bg-light p-3 rounded">
                        @Html.Raw(Model.Description.Replace("\n", "<br/>"))
                    </div>
                </div>
            </div>
        }
    </div>
    
    <div class="col-lg-4">
        <div class="card-ace mb-3">
            <div class="card-header">
                <i class="bi bi-download me-2"></i>文件下载
            </div>
            <div class="card-body">
                @if (!string.IsNullOrEmpty(Model.FilePath))
                {
                    <div class="d-grid gap-2 mb-3">
                        <a href="@Model.FilePath" class="btn btn-ace-primary" download>
                            <i class="bi bi-file-earmark-zip me-2"></i>下载版本文件
                        </a>
                    </div>
                }
                else
                {
                    <div class="text-center text-muted mb-3">
                        <i class="bi bi-file-x" style="font-size: 24px;"></i>
                        <p class="mt-2 mb-0">无版本文件</p>
                    </div>
                }
                
                @if (!string.IsNullOrEmpty(Model.ManualPath))
                {
                    <div class="d-grid gap-2">
                        <a href="@Model.ManualPath" class="btn btn-ace-info" download>
                            <i class="bi bi-file-text me-2"></i>下载操作手册
                        </a>
                    </div>
                }
                else
                {
                    <div class="text-center text-muted">
                        <i class="bi bi-file-x" style="font-size: 24px;"></i>
                        <p class="mt-2 mb-0">无操作手册</p>
                    </div>
                }
            </div>
        </div>
        
        <div class="card-ace">
            <div class="card-header">
                <i class="bi bi-tools me-2"></i>操作
            </div>
            <div class="card-body">
                <div class="d-grid gap-2">
                    <form method="post" action="/Version/Delete/@Model.Id" class="d-inline">
                        <button type="button" class="btn btn-ace-danger w-100" 
                                onclick="showDeleteConfirm('@Model.Version', this.form, '此操作将永久删除版本信息和相关文件，不可恢复！')">
                            <i class="bi bi-trash me-2"></i>删除版本
                        </button>
                    </form>
                </div>
                
                <div class="mt-3 p-3 bg-light rounded">
                    <h6 class="text-warning mb-2">
                        <i class="bi bi-exclamation-triangle me-1"></i>注意事项
                    </h6>
                    <ul class="small text-muted mb-0">
                        <li>删除版本将同时删除相关文件</li>
                        <li>已部署的客户端不受影响</li>
                        <li>建议在删除前备份重要文件</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>